<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/jquery.js"></script>
  <script src="./js/axios.js"></script>
</head>
<body>
  <button>发送请求</button>
  <script>
    function fn(url,type){
      return new Promise((resolve,reject)=>{
        $.ajax({
          type,
          url,
          data:{uname:"zhangsan",pwd:123456},
          dataType:'json',
          success:function(res){
            console.log(res);
            if(res.success){
              resolve(res)
            }else{
              reject(res.message)
            }
          },
        })
      })
    }
    $("button").click(function(){
      fn("http://127.0.0.1:3001/login","post").then(res=>{console.log(res)
      return fn("http://127.0.0.1:3001/orderlist?uid=" +res.uid,"get")}).then(res=>{
        console.log(res.list);
      }).catch(err=>console.log(err))
    }
     
    )
  </script>
</body>
</html>